import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const state = {
  username: ''
}
const mutations = {
  setusername (state, username) {
    state.username = username
  },
  getusername (state) {
    return state.username
  }
}
const actions = {
  setusernameactions ({commit}, username) {
    commit('setusername', username)
    localStorage.setItem('myusername', username)
  },
  getusernameactions ({commit}) {
    commit('getusername')
  }
}
const getters = {
  getUserName () {
    return localStorage.getItem('myusername')
  }
}

export default new Vuex.Store({
  strict: true,
  state,
  mutations,
  actions,
  getters
})
